package Core;

public class Key
{
	public final static int PU_KEY=10, PD_KEY=11, P_KEY=12, PL_KEY=13, PR_KEY=14, LS_KEY=15, RS_KEY=16, BACK_KEY=17, POUND_KEY='#', STAR_KEY='*';
	public final static int PRESSED=0, RELEASED=1, REPEATED=2;
	public final static int KEYS_TOTAL = 20;

	public static int FromKeyToNumber(int key)
	{
		if(key>='0' && key<='9') return key-'0';	// char-based
		if(key>=0 && key<=9)	return key;			// int-based
		if(key>=10 && key<=17)	return key;
		if(key == POUND_KEY)	return 18;
		if(key == STAR_KEY)		return 19;
		
		return -1;
	}

	public static int FromNumberToKey(int number)
	{
		if(number>=0 && number<=9)		return number+'0';
		if(number>=10 && number<=17)	return number;
		if(number == 18)	return POUND_KEY;
		if(number == 19)	return STAR_KEY;

		return -1;
	}

}
